﻿Imports System.Windows.Forms
Imports System.Drawing

Public Class Lightsimtest
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim gr As Graphics = GroupBox1.CreateGraphics
        Dim a(1) As PointF
        Dim eum As Control.ControlCollection = GroupBox1.Controls
        a(0) = eum.Item(0).Location
        a(1) = eum.Item(1).Location
        gr.DrawLines(New Pen(Color.Blue, 5.2), a)
        gr.Dispose()
    End Sub
    Private Class Line
        Public Property Point1 As Point
        Public Property Point2 As Point
    End Class
    Public isdownlabel1 As Boolean, isdownlabel2 As Boolean
    Private Sub Label1_MouseDown(sender As Object, e As MouseEventArgs) Handles Label1.MouseDown
        isdownlabel1 = True
        Do Until isdownlabel1
            Label1.Location = GroupBox1.PointToClient(MousePosition)
            Application.DoEvents()
        Loop
    End Sub

    Private Sub Label1_MouseUp(sender As Object, e As MouseEventArgs) Handles Label1.DoubleClick
        isdownlabel1 = False
    End Sub
    Private Sub Label2_MouseDown(sender As Object, e As MouseEventArgs) Handles Label2.MouseDown
        isdownlabel2 = True
        Do Until isdownlabel1
            Label2.Location = GroupBox1.PointToClient(MousePosition)
            Application.DoEvents()
        Loop
    End Sub

    Private Sub Label2_MouseUp(sender As Object, e As MouseEventArgs) Handles Label2.DoubleClick
        isdownlabel2 = False
    End Sub

    Private Sub Lightsimtest_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        Me.Dispose()
    End Sub
End Class